﻿#include "stdafx.h"
#include "CombatRoutine.h"


CombatRoutine::CombatRoutine()
{
}


CombatRoutine& CombatRoutine::inst()
{
	static CombatRoutine instance;
	return instance;
}

CombatRoutine::~CombatRoutine()
{
}

IRoutine* CombatRoutine::GetRoutine(int player_class, SpecializationID player_spec)
{
	IRoutine* ret = NULL;
	SpecializationID specId = (SpecializationID)player_spec;
	auto it = map_routine_.find(specId);
	if (it != map_routine_.end())
	{
		ret = it->second.get();
	}
	else
	{
		map_routine_[specId] = routine_factory_.ConstructRoutineByType(specId);
		ret = map_routine_[specId].get();
	}
	return ret;
}
